﻿@model int
@{
    ViewBag.Title = "test2";
 
}
<header>
    <link href="~/Content/search/jquery.autocomplete.css" rel="stylesheet" />
    <script src="~/Content/search/jquery.autocomplete.js"></script>
    <link href="~/Content/bookEvent.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.8.2.js"></script>
    <script src="~/Scripts/jquery-ui-1.8.24.js"></script>
</header>

<script>
    $(function () {
        $('#memberName').autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: '@Url.Action("AutoCompleteMember")',
                    dataType: "json",
                    contentType: 'application/json, charset=utf-8',
                    data: {
                        search: $("#memberName").val()
                    },
                    success: function (data) {

                        var mData = JSON.parse(data);// tóm lại là vẫn phải convert lại  :3 

                        response($.map(mData, function (item) {
                            return {
                                value: item,
                            };
                        }));
                    },
                    error: function (xhr, status, error) {
                        alert(error);
                    }
                });

            },
            minLength: 1,
            select: function (event, ui) {
                var values = ui.item.value;
               
            }
        });
    });

</script>


@using (Html.BeginForm("Index", "GroupMember",FormMethod.Post))
{
    <div class="ui-widget">
    <label for="memberName">Member Name </label>
    @Html.Editor("memberName",null,new{@Styles="width: 200px"})
    <div id="divListMember">

   </div>
         @Html.Hidden("eventID",Model)
    <input type="submit" value="Add" name="addAllMem" />
</div> 
}

<div id="lblUserId"></div>

